{include file="public/header" /}
<article class="page-container">
    <form action="" method="post" class="form form-horizontal" enctype="multipart/form-data" id="form-add">
        <div class="row cl">
            <label class="form-label col-xs-5 col-sm-5"><span class="c-red">*</span>商品名字：</label>
            <div class="formControls col-xs-5 col-sm-5">
                <input type="text" class="input-text" value="{$data.name|default=''}" placeholder="" id="name" name="name">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-5 col-sm-5">
                <span class="c-red">*</span>最小价格：</label>
            <div class="formControls col-xs-5 col-sm-5">
                <input type="number" maxlength="10" class="input-text" value="{$data.min|default=''}" placeholder="" id="min" name="min">
            </div>
            <div class="col-4"> </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-5 col-sm-5">
                <span class="c-red">*</span>最大价格：</label>
            <div class="formControls col-xs-5 col-sm-5">
                <input type="number" maxlength="10" class="input-text" value="{$data.max|default=''}" placeholder="" id="max" name="max">
            </div>
            <div class="col-4"> </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-5 col-sm-5">
                <span class="c-red">*</span>开奖时间：</label>
            <div class="formControls col-xs-5 col-sm-5">
                <input type="text" maxlength="10" class="input-text" value="{$data.lottery_time|default=''}" placeholder="请输入xx:xx:xx时间格式" id="lottery_time" name="lottery_time">
            </div>
            <div class="col-4"> </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-5 col-sm-5">
                <span class="c-red">*</span>收益天数：</label>
            <div class="formControls col-xs-5 col-sm-5">
                <input type="number" maxlength="11" class="input-text" value="{$data.days|default=''}" placeholder="" id="days" name="days">
            </div>
            <div class="col-4"> </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-5 col-sm-5">
                <span class="c-red">*</span>每天发放收益：</label>
            <div class="formControls col-xs-5 col-sm-5">
                <input type="number" maxlength="6" class="input-text" value="{$data.day_profit|default=''}" placeholder="0.xx" id="day_profit" name="day_profit" >
            </div>
            <div class="col-4"> </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-5 col-sm-5">
                <span class="c-red">*</span>每天MT：</label>
            <div class="formControls col-xs-5 col-sm-5">
                <input type="number" maxlength="6" class="input-text" value="{$data.mt|default=''}" placeholder="0.xx" id="mt" name="mt" >
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl" style="width: 100%">
            <label class="form-label col-xs-5 col-sm-5"><span class="c-red">*</span>是否可以换购：</label>
            <div class="formControls col-xs-5 col-sm-5">
                <select name="exchange" class="select">
                    <option value="0" {if isset($data.exchange) &&$data.exchange == '0'}selected{/if}>不可换购</option>
                    <option value="1" {if isset($data.exchange) && $data.exchange == '1'}selected{/if}>合约换购</option>
                    <option value="2" {if isset($data.exchange) && $data.exchange == '2'}selected{/if}>奖金换购</option>
                </select>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-5 col-sm-5">
                <span class="c-red">*</span>换购手续费(MT)：</label>
            <div class="formControls col-xs-5 col-sm-5">
                <input type="number" maxlength="6" class="input-text" value="{$data.exchange_mt|default=''}" placeholder="0.xx" id="exchange_mt" name="exchange_mt" >
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-5 col-sm-5">
                <span class="c-red">*</span>未中奖赠送(MT)：</label>
            <div class="formControls col-xs-5 col-sm-5">
                <input type="number" maxlength="6" class="input-text" value="{$data.loss_mt|default=''}" placeholder="0.xx" id="loss_mt" name="loss_mt" >
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl" style="width: 100%">
            <label class="form-label col-xs-5 col-sm-5"><span class="c-red">*</span>是否禁用：</label>
            <div class="formControls col-xs-5 col-sm-5">
                <select name="flag" class="select">
                    {if 0 == $data.flag}
                    <option value="0"  selected>禁用(用户将不能预约)</option>
                    <option value="1" >启用</option>
                    {else/}
                    <option value="0"  selected>禁用(用户将不能预约)</option>
                    <option value="1" selected>启用</option>
                    {/if}
                </select>
            </div>

        </div>

        <div class="row cl">
            <div class="col-xs-5 col-sm-5 col-xs-offset-4 col-sm-offset-3">
                <input type="hidden" value="{$data.id|default=''}" name="id">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>


{include file="public/footer" /}
<script type="text/javascript">
    $(function(){

        $("#form-add").validate({
            rules:{

            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                $(form).ajaxSubmit({
                    success:function(data){
                        console.log(data);
                        if(data.status == 0){
                            layer.msg("操作成功",{icon:1,time:1000,shade: [0.3, '#000']},function(){
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.location.reload();
                                parent.layer.close(index);
                            });
                        }else{
                            layer.msg(data.info,{icon:2,time:1000,shade: [0.3, '#000']});
                        }
                    },
                    error:function(error){
                        layer.msg('系统发生了错误',{icon:2,time:3000,shade: [0.5, '#FF0000']});
                    }
                });
            }
        });
    });
</script>
